package com.springboot.demo.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.util.Date;
import java.util.List;

/**
 * @author wubc683
 * @desc
 * @date 2021-07-26 14:10
 */
@Data
@Api
public class Device {
    @ApiModelProperty(value = "设备id",required = true)
    @NotNull(message = "设备id不能为null")
    private Long id;
    @ApiModelProperty("mico客户端服务器设备id")
    private Long micoDeviceId;
    @ApiModelProperty("设备群id")
    private Long deviceClusterId;
    @ApiModelProperty("设备群名称")
    private String deviceClusterName;
    @ApiModelProperty(value = "设备名",required = true)
    private String deviceName;
    @ApiModelProperty(value = "设备mac地址")
    private Long macAddr;
    @ApiModelProperty(value = "设备描述,不超过64位",required = true)
    @NotNull(message = "设备描述不能为null")
    @Size(max = 64, message = "设备描述太长")
    private String description;
    @ApiModelProperty(value = "设备注册日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createDate;
    @ApiModelProperty(value = "设备是否在线，0表示离线,1表示在线")
    private Boolean online;
    @ApiModelProperty(value = "设备所在地址,不超过64位")
    @Length(max = 64, message = "设备地址太长")
    private String address;
    @ApiModelProperty(value = "设备所在省")
    @Length(max = 16,message = "设备所在省长度超过限制值")
    private String province;
    @ApiModelProperty(value = "设备所在市")
    @Length(max = 16,message = "设备所在市长度超过限制值")
    private String city;
    @ApiModelProperty(value = "设备所在区")
    @Length(max = 16,message = "设备所在区长度超过限制值")
    private String region;
    @ApiModelProperty(value = "设备地址在地图中的经度,小数不超过6位")
    @Min(value = -180,message = "经度超过限制值")
    @Max(value = 180,message = "经度超过限制值")
    private Double longitude;
    @ApiModelProperty(value = "设备地址在地图中的维度,小数不超过6位")
    @Min(value = -90,message = "纬度超过限制值")
    @Max(value = 90,message = "纬度超过限制值")
    private Double latitude;
    @ApiModelProperty("是否已删除,0未删除，其他未删除")
    private Integer deleteFlag;
}
